package edu.uvic.TabViz.framework.primitives;

import java.io.Serializable;

public class Light implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6058660256875023709L;
	protected float[] color = new float[3];
	protected float[] direction = new float[3];
	protected Point3D position, rotation;
	protected float intensity = 1;
	
	public Light(){
		position = new Point3D();
		rotation = new Point3D();
		setColor(1.0f, 1.0f, 1.0f);
		setDirection(0, -1.0f, 1.0f);
	}

	public Light(Light light) {
		color = light.color;
		direction = light.direction;
		intensity = light.intensity;
		position = new Point3D(light.getPosition());
		rotation = new Point3D(light.getRotation());
	}

	public float[] getColor() {
		return color;
	}

	public void setColor(float[] color) {
		this.color = color;
	}
	
	public void setColor (float r, float g, float b){
		color[0] = r;
		color[1] = b;
		color[2] = b;
	}
	
	public float[] getDirection() {
		return direction;
	}

	public void setDirection(float[] direction) {
		this.direction = direction;
	}
	
	public void setDirection(float x, float y, float z){
		direction[0] = x;
		direction[1] = y;
		direction[2] = z;
	}
	
	public Point3D getPosition() {
		return position;
	}

	public void setPosition(Point3D position) {
		this.position = position;
	}

	public Point3D getRotation() {
		return rotation;
	}

	public void setRotation(Point3D rotation) {
		this.rotation = rotation;
	}

	public float getIntensity() {
		return intensity;
	}

	public void setIntensity(float intensity) {
		this.intensity = intensity;
	}
	
	@Override
	public int hashCode() {
		return position.hashCode() + rotation.hashCode() + color.hashCode() + direction.hashCode() + (int) intensity;
	}
}
